home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / StreetsAlleys.dxr / Internal_7_foundation cards.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  2.5 KB  |  89 lines

  1. property spriteNum, column, baserank, myLoc
  2. global equal, currentsel, godlist, foundation, mover
  3.  
  4. on beginSprite me
  5.   baserank = #ace
  6.   myLoc = sprite(spriteNum).loc
  7.   column = determinecolumn()
  8.   foundation.addProp(column, new(script("card pile")))
  9. end
  10.  
  11. on determinecolumn me
  12.   if spriteNum = 10 then
  13.     return #one
  14.   else
  15.     if spriteNum = 11 then
  16.       return #two
  17.     else
  18.       if spriteNum = 12 then
  19.         return #three
  20.       else
  21.         if spriteNum = 13 then
  22.           return #four
  23.         end if
  24.       end if
  25.     end if
  26.   end if
  27. end
  28.  
  29. on mouseDown me
  30.   if sprite(spriteNum).member <> member("empty", "playing cards") then
  31.     puppetSound(3, "pickcard")
  32.     action = 1
  33.     sprite(spriteNum).locZ = spriteNum + 1000
  34.     mover = timeout("move").new(1, #moveme, me)
  35.     if foundation[column].getcardcount() > 1 then
  36.       sprite(spriteNum - 4).member = member(foundation[column].cards[foundation[column].getcardcount() - 1].membername, "playing cards")
  37.     else
  38.       sprite(spriteNum - 4).member = member("empty", "playing cards")
  39.     end if
  40.   end if
  41. end
  42.  
  43. on moveme me
  44.   sprite(spriteNum).loc = the mouseLoc
  45.   if the stillDown = 0 then
  46.     mover.forget()
  47.     sprite(spriteNum).loc = myLoc
  48.   end if
  49. end
  50.  
  51. on mouseUp me
  52.   if sprite(spriteNum).member <> member("empty", "playing cards") then
  53.     if sprite(spriteNum).loc = the mouseLoc then
  54.       if equal = 1 then
  55.         puppetSound(3, "pickcard")
  56.         action = 0
  57.         mover.forget()
  58.         sprite(spriteNum).locZ = spriteNum
  59.         sprite(spriteNum).loc = foundation[column].getlastcard().location
  60.         sprite(currentsel).member = sprite(spriteNum).member
  61.         if sprite(currentsel).visible = 0 then
  62.           sprite(currentsel).visible = 1
  63.         end if
  64.         foundation[column].cards.deleteOne(foundation[column].getlastcard())
  65.         if foundation[column].getcardcount() > 0 then
  66.           sprite(spriteNum).member = member(foundation[column].getlastcard().membername, "playing cards")
  67.         else
  68.           sprite(spriteNum).member = member("empty", "playing cards")
  69.         end if
  70.         godlist.addCard(currentsel)
  71.         if (currentsel >= 14) and (currentsel <= 127) then
  72.           points = points - 10
  73.         end if
  74.         equal = 0
  75.         currentsel = 0
  76.         godlist = VOID
  77.         checkwin()
  78.       else
  79.         if equal = 0 then
  80.           puppetSound(3, "dropcard")
  81.           mover.forget()
  82.           sprite(spriteNum).locZ = spriteNum
  83.           sprite(spriteNum).loc = foundation[column].getlastcard().location
  84.         end if
  85.       end if
  86.     end if
  87.   end if
  88. end
  89.